package com.library.pojo.entity;

import com.library.pojo.dto.book.BookDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * library_books(图书表)实体类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LibraryBooks implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 图书编号
     */
    private Integer bookId;

    /**
     * 图书名称
     */
    private String name;

    /**
     * 图书作者
     */
    private String author;

    /**
     * 图书出版社
     */
    private String publisher;

    /**
     * 图书价格
     */
    private BigDecimal price;

    /**
     * 库存数量
     */
    private Integer stock;

    /**
     * 可借数量
     */
    private Integer loan;

    public LibraryBooks(BookDTO bookDTO) {
        this.bookId = bookDTO.getBookId();
        this.name = bookDTO.getName();
        this.author = bookDTO.getAuthor();
        this.publisher = bookDTO.getPublisher();
        this.price = bookDTO.getPrice();
        this.stock = bookDTO.getStock();
        this.loan = bookDTO.getLoan();
    }
}
